f1 = open('record.txt')
str1=[]
str2=[]
count =1
for i in f1:
    if i[0:2] !=  '==':
        (name,speak) = i.split(':',1)
        if name == '小甲鱼':
            str1.append(speak)
        else :
            str2.append(speak)
    else :
        boy_name = 'boy_' +str(count) +'.txt'
        girl_name = 'girl'+str(count) +'.txt'
        boy = open(boy_name,'x')
        girl = open(girl_name,'x')
        boy.writelines(str1)
        girl.writelines(str2)
        boy.close()
        girl.close()
        count +=1
        str1=[]
        str2=[]
boy_name = 'boy_' +str(count) +'.txt'
girl_name = 'girl'+str(count) +'.txt'
boy = open(boy_name,'x')
girl = open(girl_name,'x')
boy.writelines(str1)
girl.writelines(str2)
boy.close()
girl.close()
        
f1.close()
